package com.yishe.biz.wx.recharge;

import com.yishe.biz.BaseBiz;
import com.yishe.entites.mysql.RechargeDiscountInfo;
import com.yishe.mapper.mysql.RechargeDiscountInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : chusifeng
 * @version :
 * @date :Create in 2021/4/23 14:42
 * @description: 充值缴费
 * @package com.yishe.biz.wx.recharge
 * @className RechargeBiz
 */
@Service
@Slf4j
public class RechargeBiz extends BaseBiz<RechargeDiscountInfoMapper , RechargeDiscountInfo> {

    /**
     * 获取可用的充值优惠券
     * @param account
     * @return
     */
    public List<RechargeDiscountInfo> getDisCounts(String account) {
        RechargeDiscountInfo discountInfo = new RechargeDiscountInfo();
        //0 启用
        discountInfo.setStatus(0);
        return this.selectList(discountInfo);
    }

    public void saveDis(RechargeDiscountInfo discountInfo) {
        if (null == discountInfo.getId()){
            this.insert(discountInfo);
        } else {
            this.updateById(discountInfo);
        }
    }
}
